<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo1"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<body>
<style>
    .form-search .layui-form-label {
        display: block;
    }
</style>
<div class="layui-card">

    <div class="layui-card-header">
        <span class="layui-icon font-s10 color-desc margin-right-5"></span>陪诊/陪检管理
        <div class="pull-right">
<!--            <button data-table-id="NoticeTable" class="layui-btn layui-btn-primary  layui-btn-sm" data-modal="/system/user/form" data-height="720px" data-width="800px">-->
<!--                <i class=" layui-icon layui-icon-addition"></i>新建护工</button>-->
        </div>
    </div>

    <div class="layui-card-line"></div>

    <div class="layui-card-body">

        <div class="layui-card-table layui-tab">
            <div class="layui-tab-content">
                <form  class="layui-form layui-form-pane form-search" action="/pcs/porter/index_p" onsubmit="return false" method="get" autocomplete="off">
                    <div class="layui-form-item layui-inline">
                        <label class="layui-form-label">患者姓名</label>
                        <div class="layui-input-inline">
                            <input name="patientName" value="" placeholder="请输入患者姓名" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item layui-inline">
                        <label class="layui-form-label">陪护员</label>
                        <div class="layui-input-inline">
                            <input name="porterName" value="" placeholder="请输入陪护员" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-inline">
                        <label class="layui-form-label">订单类型</label>
                        <div class="layui-input-inline">
                            <select name="type" >
                                <option value="">全部</option>
                                <option value="2">陪诊</option>
                                <option value="3">陪检</option>
                            </select>
                        </div>
                    </div>


                    <div class="layui-form-item layui-inline">
                        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
                        <button type="reset" class="layui-btn layui-btn-primary" onclick="$.form.reload();">重置</button>
                    </div>
                </form>
                <table id="OrderPTable"  data-url='/pcs/order/index_p' data-target-search="form.form-search"></table>
                <script th:inline="javascript">
                    var porterName = [[${porterName}]]
                    var orderStatus = [[${orderStatus}]]
                    var type = [[${type}]]
                </script>
                <script type="text/javascript" th:inline="none">
                    $(function () {
                        $('#OrderPTable').layTable({
                            even: true, height: 'full',
                            where:{
                                porterName:porterName,
                                orderStatus:orderStatus,
                                type:type
                            },
                            cols: [[
                                {title: '序号', type: 'numbers', width: 80},
                                {field: 'sn', title: '订单编号', minWidth: 220, align: 'center'},
                                {field: 'type', title: '订单类型', minWidth: 90, align: 'center',templet: function (d) {
                                        if (d.type == 2) {
                                            return '陪诊';
                                        } else if (d.type == 3) {
                                            return '陪检';
                                        } else {
                                            return '未知';
                                        }
                                    }},
                                {field: 'patientName', title: '患者姓名', minWidth: 100, align: 'center'},
                                {field: 'phone', title: '患者号码', minWidth: 100, align: 'center'},
                                {field: 'projectTitle', title: '服务项目', minWidth: 180, align: 'center'},
                                {field: 'porterName', title: '服务人员', minWidth: 90, align: 'center'},
                                {field: 'price', title: '服务费用', minWidth: 90, align: 'center'},
                                {field: 'orderStatus', title: '订单状态', minWidth: 90, align: 'center',templet: function (d) {
                                       let str = ""
                                        switch (d.orderStatus){
                                            case -1:
                                                str = "已取消";
                                                break;
                                            case 0:
                                                if(d.payStatus == 1){
                                                    str = "待接单";
                                                }else{
                                                    str = "待付款";
                                                }

                                                break;
                                            case 1:
                                                str = "待签订合同";
                                                break;
                                            case 2:
                                                str = "服务中";
                                                break;
                                            case 3:
                                                str = "等待充值";
                                                break;
                                            case 4:
                                                str = "等待日期选择";
                                                break;
                                            case 5:
                                                str = "服务完成 待评价";
                                                break;
                                            case 6:
                                                str = "已评价";
                                                break;
                                        }
                                        return str;

                                    }},
                                {field: 'startDay', title: '陪诊时间', minWidth: 150, align: 'center'},
                                {field: 'createTime', title: '创建时间', minWidth: 100, align: 'center'},
                                {field: 'companyName', title: '陪护公司', minWidth: 200, align: 'center'},
                                {toolbar: '#toolbar', title: '操作', align: 'center', minWidth: 120, fixed: 'right'}
                            ]]
                        });
                    });



                </script>

                <!-- 数据状态切换模板 -->
                <script type="text/html" id="StatusSwitchTpl">
                    <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="已激活|已禁用" lay-filter="StatusSwitch" {{-d.status>0?'checked':''}}>
<!--                    {{-d.status ? '<b class="color-green">已启用</b>' : '<b class="color-red">已禁用</b>'}}-->
                </script>

                <script type="text/html" id="toolbar">
                    <a class="layui-btn layui-btn-sm" data-event-dbclick data-title="查看订单" data-offset="r" data-anim="slideLeft" data-width="90%" data-height="100%"  shiro:hasPermission="pcs:order:detail" data-modal='/pcs/order/detail?id={{d.id}}'>查看订单</a>

                </script>

            </div>
        </div>
    </div>

</div>
</body>
</html>